<template>
	<view class="detailall">
	<!-- 	//navbar头部 -->
		<navbar left-text="退后" right-text="分享" @clickLeft="goback"> 
			<view class="na-all" @click="clickrighttext">
				<view class="lleft">
					<image class="lleft" src="/static/tabBar/share.png" mode=""></image>
				</view>

			</view>
		</navbar>
	
		<view class="detail-top">
			<!-- 头像图片 -->
			<view class="imgtitle-t">
				<image class="imgtitle" :src="detail_tea.img" mode=""></image>
			</view>
			<!-- 头像右侧 -->
			<view class="detail-top-c">
				<view class="c-name">
					{{this.detail_tea.name}}&nbsp;&nbsp;[{{this.detail_tea.nowmy}}]&nbsp;&nbsp;{{this.detail_tea.sex}}
				</view>
				<view class="c-review">
					<view class="c-review-item">
						<view class="c-review-it">
							<view class="c-review-it-t">
								评价
							</view>
							<view class="c-review-it-b">
								{{this.detail_tea.mark}}分
							</view>
						</view>
						
					</view>
					<view class="c-review-item">
						<view class="c-review-it">
							<view class="c-review-it-t">
								成功
							</view>
							<view class="c-review-it-b">
								0
							</view>
						</view>
						
					</view>
					<view class="c-review-item">
						<view class="c-review-it">
							<view class="c-review-it-t">
								经验
							</view>
							<view class="c-review-it-b">
								2-3年
							</view>
						</view>
						
					</view>
					<view class="c-review-item">
						<view class="c-review-it">
							<view class="c-review-it-t">
								满意度
							</view>
							<view class="c-review-it-b">
								0%
							</view>
						</view>
						
					</view>
				</view>
			</view>
		</view>
		<!-- 按钮框 -->
		<view class="detai-but">
			<view class="button-all">
				<button  class="butleft" @click="online">立即预约</button>
				
			</view>
			<view class="button-all">
				<button class="butright">QQ预约教员</button>
			</view>
		</view>
		<!-- 个人详细数据 -->
		<view class="content-all">
			<!-- 顶部标题 -->
			<view class="contenttit">
				<view class="">
					<image class="smallico" src="../../static/tabBar/myself.png" mode=""></image>
				</view>
				<view class="">
					基本信息
				</view>
			</view>
			<view class="" >
				<view class="content-cont" >
					<view class="cont-left">
						编号:
					</view>{{this.detail_tea.id}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						教员称呼:
					</view>
					{{this.detail_tea.name}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						教员性别:
					</view>
					{{this.detail_tea.sex}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						出生年月:
					</view>
					<!-- {{this.detail_tea.birthday.split('T')[0]}} -->
					{{this.detail_tea.birthday}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						籍贯:
					</view>
					{{this.detail_tea.place}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						目前身份:
					</view>
					{{this.detail_tea.nowmy}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						院校:
					</view>
					{{this.detail_tea.school}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						专业:
					</view>
					{{this.detail_tea.profession}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						可授科目:
					</view>
					{{this.detail_tea.subject}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						授课区域:
					</view>
					{{this.detail_tea.arce}}
				</view>
				<view class="content-cont" >
					<view class="cont-left">
						课时收费:
					</view>
					{{this.detail_tea.money}}
				</view>
				
			</view>
		</view>
		<!-- 授课时间 -->
		<view class="tableclass">
			<view class="contenttit">
				<view class="">
					<image class="smallico" src="../../static/tabBar/datatime.png" mode=""></image>
				</view>
				<view class="">
					授课时间
				</view>
			</view>
			<table>
			  <tr class="tabletop">
			    <td>时间</td>
			     <td v-for="(item,index) in 5" :key="index"> {{index+1}}</td>	
				 <td>六</td>
				 <td>日</td>
				 <td>寒假</td>
			  </tr>
			  <tr class="trmorning">
				  <td>上午</td>
				  
			  </tr>
			  <tr class="trafter">
			  		<td>下午</td>
					<td v-for="item in 8" style="color: #e44032;">√</td>
			  </tr>
			  <tr class="trnight">
			  	  <td>晚上</td>
				<td v-for="item in 8" style="color: #e44032;">√</td>
			  </tr>
			</table>

		</view>
		<!-- 个人简历 -->
		<view class="intro">
			<view class="contenttit" >
				<view class="">
					<image class="smallico" src="../../static/tabBar/jianjie.png" mode=""></image>
				</view>
				<view class="">
					个人简介
				</view>
			</view>
			<view class="intro-content">
				{{this.detail_tea.content}}
			</view>
		</view>
		<!-- 荣誉证书 -->
		<view class="intro">
			<view class="contenttit" >
				<view class="">
					<image class="smallico" src="../../static/tabBar/youxiu.png" mode=""></image>
				</view>
				<view class="">
					荣誉/证书
				</view>
			</view>
		</view>
		<!-- 教学案例 -->
		<view class="intro">
			<view class="contenttit" >
				<view class="">
					<image class="smallico" src="../../static/tabBar/anli.png" mode=""></image>
				</view>
				<view class="">
					教学案例
				</view>
				
			</view>
			<view class="intro-content">
				{{this.detail_tea.profile}}
			</view>
		</view>
	<!-- 	家长评价 -->
		<view class="intro">
			<view class="contenttit" >
				<view class="">
					<image class="smallico" src="../../static/tabBar/pingjia.png" mode=""></image>
				</view>
				<view class="">
					家长评价
				</view>
			</view>
		</view>
		<view v-if="isShow" class="reserva-detal" @touchmove.stop.prevent="">
			<!-- 阴影框 -->
			<view class="pop-mask" @tap="hidePop()">
			</view>
			<view class="pop-box" :animation="animationData">
				<view class="pop-btitle">
					<view class="pop-item">
						<view class="" v-for="(item,index) in list" :key="item.id" @click="gosharelist(item.id)">
							<image style="width: 100rpx;height: 100rpx;padding:30rpx 50rpx;" :src="item.img" mode=""></image>
							<view class="pop-item-title">
								{{item.title}}
							</view>
						</view>
						
					</view>
				</view>
		
				<view class="pop-sub" @tap="gocancel">
					取消
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navbar from '@/components/uni/uni-nav-bar/uni-nav-bar.vue'
	import mline from '@/components/common/Lines.vue'
	import $http from '@/common/api/request.js'
	export default {
		data() {
			return {
				isShow: false,
				animationData: {}, //动画过渡
				submitvipform:{},
				temptelid:0,
				detail_tea:{},//接收教师的信息
				cicons:[{id:0,img:"/static/tabBar/kj_icon.jpg",title:"qq空间"},
				{id:1,img:"/static/tabBar/weibo.jpg",title:"新浪微博"},
				{id:2,img:"/static/tabBar/renren.jpg",title:"人人网"},
				{id:3,img:"/static/tabBar/dou.jpg",title:"豆瓣"},],
				list:[{id:0,title:"微信好友",img:"../../static/tabBar/weixin.jpg"},
					{id:1,title:"微信朋友圈",img:"../../static/tabBar/friend.jpg"},
					{id:2,title:"微信收藏",img:"../../static/tabBar/linka.jpg"},
					{id:3,title:"新浪微博",img:"../../static/tabBar/weibo.jpg"},
					{id:4,title:"QQ",img:"../../static/tabBar/qq.jpg"},
					{id:5,title:"二维码",img:"../../static/tabBar/shop.jpg"},
				]
			};
		},
		components: {
			navbar,mline
		},
		methods:{
			goback(){
				uni.navigateBack({
					delta:1
				})
			},
			clickrighttext() {
				this.isShow = true;
				
			},
			gosharelist(index){
				if(index === 0){
					this.shareall("weixin","WXSceneSession")
				}else if(index === 1){
					this.shareall("weixin","WXSceneTimeline")
				}else if(index === 2){
					this.shareall("weixin","WXSceneFavorite")
				}else if(index === 3){
					this.shareall("sinaweibo","")
				}else if(index === 4){
					this.shareall("qq","")
				}else if(index === 5){
					this.shareall("weixin","WXSceneSession")
				}
				
			},
			shareall(provider,scene){
				uni.share({
					provider:provider,//微信
					type: 0,
					scene: scene,//WXSceneSession
					title: this.detail_tea.content,
					summary: `我正在看${this.detail_tea.name}老师信息，赶紧跟我一起来体验吧！`,
					href: `https://static-mp-226e15e0-3338-4b4a-a504-1a5766808d99.next.bspapp.com/#/pages/detail/detail?id=${this.temptelid}`,
					imageUrl: this.detail_tea.img,
					success: function(res) {
						uni.showTabBar({
							title: "分享成功"
						})
					},
					fail: function(err) {
						console.log("fail:" + JSON.stringify(err));
					}
				})
			},
			online(){
				if(this.submitvipform === {}){
					this.navigateTo({
						url:`/pages/reservation_s/reservation_s?detail_tea=${JSON.stringify(this.detail_tea)}`	
					})
				}else{
					this.navigateTo({
					url:`/pages/reservation_s/reservation_s?detail_tea=${JSON.stringify(this.detail_tea)}&submitvipform=${JSON.stringify(this.submitvipform)}`	
				})
				}
				
				
			},
			//照片处理:
			newString(originalString){
				return `https://zyc618.mynatapp.cc/${originalString}`;
			},
			//根据id获取教师的信息
			getdata(tec_id){
				$http.request({
					url: "/getidteacherlist",
					method:"POST",
					data:{
						id:tec_id
					}
				}).then((res) => {
					uni.showToast({
						title: "加载中...",
						icon: "none",
						mask: true,
						duration: 200,
						success: () => {
							this.detail_tea=res;
							this.detail_tea.img = this.newString(this.detail_tea.img);
						}
					})
				}).catch(() => {
					uni.showToast({
						title: "未登录,禁止查看教员信息",
						icon: "none",
						mask: true,
						duration: 3000,
					})
					
				})
			}
			
		},
		onLoad(e) {
			this.getdata(e.id);
			this.temptelid = e.id;
			if(e.submitvipform){
				
				this.submitvipform = JSON.parse(e.submitvipform);
			}else{
				this.submitvipform = {}
				
			}
			
		}
	}
</script>

<style lang="scss">
	.detailall{
		background-color: #f8f8f8
	}
	.tableclass{
		margin: 40rpx 0;
		
		table {
		      width: 100%;
		      border: 1px solid black;
		      margin: 0 auto;
		      border-collapse: collapse;
		  }
		.tabletop{
			background-color: #cfcfcf;
		}
		  td {
		      height: 50px;
				width: 10%;
		      border: 1px solid black;
		      text-align: center;
		      vertical-align: center;
		  }
			
		  .trmorning {
		      background-color: #fffef2;
		  }
				.trafter {
				    background-color: #eff9fe;
				}
				.trnight {
				    background-color: #fef3f7;
				}
	}
	  
	.na-all {
		width: 100%;
		display: flex;
		align-items: center;
		position: relative;
		.lleft {
			width: 40rpx;
			height: 40rpx;
			position: absolute;
			right: 0;
			top: 10rpx;
		}

		.rright {
			width: 40rpx;
			height: 40rpx;
		}
	}
	.detail-top{
		display: flex;
		.imgtitle-t{
			margin: 30rpx;
			overflow: hidden;
			width: 20%;
			height: 150rpx;
			background-color: #309de0;
			border-radius: 100rpx;
			.imgtitle{
				width: 100%;
				height: 150rpx;
				border-radius: 100rpx;
			}
		}
		.detail-top-c{
			width: 75%;
			.c-name{
				color: #309de0;
				font-weight: 500;
				margin-top: 30rpx;
			}
			.c-review{
				display: flex;
				justify-content: space-around;
				width: 100%;
				.c-review-item{
					display: flex;
					
					.c-review-it{
						text-align: center;
						.c-review-it-t{
							
						}
						.c-review-it-b{
							color: #309de0;
						}
				}
				.rigbording{
					border-right: 1rpx solid #cfcfcf;
					height: 60rpx;
					padding: 10rpx 20rpx;
				}
				}
				
			}
		}
		
	}
	.detai-but{
		color: #FFFFFF;
		border-radius: 10rpx;
		display: flex;
		padding: 5rpx 20rpx;
		.button-all{
			width: 95%;
			.butleft{
				font-size: 24rpx;
			background-color: #309de0;
			margin-right: 10rpx;
		}
		.butright{
			font-size: 24rpx;
			background-color: #ffbb17;
		}
		}
		
	}
	.content-all{
		margin-top: 20rpx;
		background-color: #FFFFFF;
		.content-cont{
			display: flex;
			padding: 20rpx 20rpx;
				.cont-left{
					width: 25%;
					display: flex;
					justify-content: space-between;
				}
				.cont-right{
					
				}
		}
	}
	.intro{
		margin-top: 30rpx;
	}
	.contenttit{
		color: #309de0;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
		height: 100rpx;
		margin-top: 30rpx;
		background-color: #FFFFFF;
		.smallico{
			width: 40rpx;
			height: 40rpx;
			margin-right: 10rpx;
		}
	}
	.intro-content{
		text-indent: 32.4px;
		padding: 10rpx 0;
	}
	.reserva-detal {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		z-index: 999;
	
		.pop-mask {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			background-color: rgba(0, 0, 0, .6);
		}
	
		.pop-box {
			position: absolute;
			left: 0;
			bottom: 0;
			width: 100%;
			background-color: #ffffff;
			border-radius: 30rpx;
	
			.pop-btitle {
				height: 450rpx;
				.pop-item{
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					align-items: center;
					.pop-item-title{
						display: flex;
						justify-content: center;
						align-items: center;
					}
				}
			}
	
	
			.pop-sub {
				z-index: 9999;
				line-height: 80rpx;
				text-align: center;
				margin-bottom: 120rpx;
			}
		}
	}
</style>